package com.ptp.backendcertms.basiccompnents.data.dao.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ptp.backendcertms.basiccompnents.data.dao.entity.SettingLoginUserPo;
import com.ptp.backendcertms.basiccompnents.data.dao.mapper.ISettingLoginUserMapper;
import com.ptp.backendcertms.basiccompnents.data.dao.service.ISettingLoginUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;


/**
 * 用户登录表 服务实现类
 *
 * @author penghaitao
 * @since 2025-05-04
 */
@Service
public class SettingLoginUserServiceImpl extends ServiceImpl<ISettingLoginUserMapper, SettingLoginUserPo> implements ISettingLoginUserService {

    @Override
    public SettingLoginUserPo selectLogin(String userName, String password) {
        LambdaQueryWrapper<SettingLoginUserPo> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(SettingLoginUserPo::getUserName, userName);
        queryWrapper.eq(SettingLoginUserPo::getPassword, password);
        queryWrapper.eq(SettingLoginUserPo::getEnableUse, true);
        queryWrapper.last("limit 1");
        return baseMapper.selectOne(queryWrapper);
    }

}
